/*
*编写程处理一个string类型的list容器。在该容器中寻找一个特殊值，如过找到，则将它删除掉。
*用deque容器重写上述程序
*/
#include <iostream>
#include <deque>
#include <list>
#include <string>
using namespace std;


int main()
{
	list<string> slist;
	slist.push_back("aaa");
	slist.push_back("bbb");
	slist.push_back("ccc");
	slist.push_back("ddd");
	slist.push_back("eee");

	for(list<string>::iterator iter = slist.begin();iter != slist.end();iter++)
	{
		if(*iter == "ccc")
		{
			iter = slist.erase(iter);
			--iter;
		}
	}

	for(list<string>::iterator iter = slist.begin();iter != slist.end();iter++)
	{	
		cout << *iter << "  ";
	}
	
	cout << endl;

	deque<string> sdeq;
	sdeq.push_back("aaa");
	sdeq.push_back("bbb");
	sdeq.push_back("ccc");
	sdeq.push_back("ddd");
	sdeq.push_back("eee");

	for(deque<string>::iterator iter = sdeq.begin();iter != sdeq.end();iter++)
	{
		if(*iter == "ddd")
		{
			iter = sdeq.erase(iter);
			--iter;
		}
	}

	for(deque<string>::iterator iter = sdeq.begin();iter != sdeq.end();iter++)
	{	
		cout << *iter << "  ";
	}

	cout << endl;
	system("pause");
	return 0;
}
